home *** CD-ROM | disk | FTP | other *** search
/ Belgian Amiga Club - ADF Collection / BS1 part 19.zip / BS1 part 19 / how to learn assembler.adf / CH5 / 5_2timimg_test.asm < prev    next >
Assembly Source File  |  1988-02-25  |  784b  |  28 lines

  1. ;(5.2) timing
  2. test:
  3.        bsr     gettime         ;Put cuttent time in D&
  4.        move.l  d7,d6           ;save it in d6
  5.        bsr     routine         ;routine to be timed
  6.        bsr     gettime         ;get time again       sub.l  d6,d7            ;elpased time in 1/50 seconds in d7!
  7.        nop                     ;breakpoint here
  8.  
  9. routine:
  10.        move.l  #500,d0        ;counter
  11. loop:
  12.        dbra    d0,loop         ;delay count down
  13.        rts
  14.  
  15. gettime:
  16.        move.b  $bfea0a,d7      ;Hi-byte in d0
  17.        lsl.l   #4,d7           ; shift twice by 4 bits
  18.        lsl.l   #4,d7           ;(8 bits shifted)
  19.        move.b  $bf901,d7       ;get mid-byte
  20.        lsl.l   #4,d7
  21.        lsl.l   #4,d7           ;shift again
  22.        move.b  $bfe901,d7      ;get lo-byte
  23.        rts
  24.  
  25.  end
  26.  
  27.  
  28.